﻿using System;
using System.Linq;
using DefaultValues.Model;
using NUnit.Framework;
using Xtensive.Orm;
using Xtensive.Orm.Configuration;
using Xtensive.Orm.Providers;

namespace DefaultValues
{
    public class Program
    {
        [Test]
        public static void Main()
        {
            // Loading domain configuration section with name "Default".
            var domainConfiguration = DomainConfiguration.Load("Default");
            var domain = Domain.Build(domainConfiguration);

            using (var session = domain.OpenSession()) {
                using (var t = session.OpenTransaction()) {
                    // DataObjects.Net automatically sets BookPrice value to 1.99
                    var book = new Book(session) {
                        Title = "DataObjects.Net unleashed"
                    };

                    Console.WriteLine("Book price is {0}", book.Price);

                    t.Complete();
                }
            }
        }
    }
}
